package com.app.piemoment.talk;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.app.piemoment.R;

public class MessageItemView extends FrameLayout {

	private LinearLayout middle_view, middle_view_out;
	private View view;
	private ImageView arrow;
	private TextView title, contexts;
	private boolean isShow = false;
	private LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(40, 40);

	public MessageItemView(Context context) {
		super(context);
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		view = inflater.inflate(R.layout.helpitem, this, true);
		middle_view = (LinearLayout) view.findViewById(R.id.middle_view);
		arrow = (ImageView) view.findViewById(R.id.arrow);
		title = (TextView) view.findViewById(R.id.title);
		contexts = (TextView) view.findViewById(R.id.contexts);
	}

	public MessageItemView(Context context, AttributeSet attrs) {
		super(context, attrs);

		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		view = inflater.inflate(R.layout.helpitem, this, true);
		arrow = (ImageView) view.findViewById(R.id.arrow);
		title = (TextView) view.findViewById(R.id.title);
		contexts = (TextView) view.findViewById(R.id.contexts);
	}

	public void setShowContexts() {
		contexts.setVisibility(View.VISIBLE);
	}

	public void setGoneContexts() {
		contexts.setVisibility(View.GONE);
	}

	public void changeStates() {
		isShow = !isShow;
		if (isShow) {
			setShowContexts();
		} else {
			setGoneContexts();
		}
	}
}
